package com.nolydake.swingnote.gui.list;

import java.awt.Color;
import java.text.SimpleDateFormat;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.nolydake.swingnote.model.NoteForder;
import com.nolydake.swingnote.util.ImageUtil;

public class ForderPanel extends JPanel {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = -6538580050741328481L;

    private NoteForder noteForder = null;

    public ForderPanel(NoteForder noteForder) {

        super();
        this.noteForder = noteForder;

        initGui();
    }

    private void initGui() {

        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        this.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY));

        ImageIcon icon = ImageUtil.loadImageIcon("common", "forder.png");

        JLabel lblName = new JLabel(noteForder.name);
        lblName.setIcon(icon);
        this.add(lblName);

        SimpleDateFormat sdf = new SimpleDateFormat();
        JLabel lblUpdateTime = new JLabel(sdf.format(noteForder.lastUpdateTime));
        this.add(lblUpdateTime);
    }
}
